import requests

url1='http://8.137.19.140:9090/blog/getBlogDetail?blogId=15686'
url='https://www.baidu.com'
url2="https://www.google.com/"
headers={
    "user_token_header":"xxxxxxxxxxxxxx"
}
params={"blogId":123456}

# 传递headers,这里的get请求url上拼接的参数也可以单独拿下来写，以params的方式
response = requests.request(method="GET",url=url,headers=headers,params=params)
response.encoding='utf-8'
print(response.status_code)

data = {"username":1234,
        "password":1212 
}

#===============================================================================================
# 一般来说get请求使用params参数。post请求使用data参数，且格式为表单格式
response = requests.request(method="POST",url=url,data=data)
# 防止乱码
response.encoding='utf-8'
print(response.text)
#===============================================================================================
# 携带cookies
cookies = {"aaaa": "aaaaaaaaaaaaaaaaaa"}
response = requests.post(url, data=data, cookies=cookies)






